#ifndef GAMESCENE_H
#define GAMESCENE_H

#include <QMainWindow>
#include <QLabel>
#include <QTimer>
#include<QMouseEvent>
class gamescene : public QMainWindow
{
    Q_OBJECT
public:
    explicit gamescene(QWidget *parent = nullptr);
    void paintEvent(QPaintEvent*)override;
    void resetGame();
protected:
    void mousePressEvent(QMouseEvent*event)override;
public slots:
    void startmoving();
private slots:
    void updateRunningAnimation();
    void moveObject();
    void checkCollision();
private:
    QTimer *anitimer;
    QTimer *moveTimer;
    int currentFrame;
    const int frameCount = 6; // 假设共有6帧图片
    QLabel *runningManLabel;
    QLabel *movingObjectLabel;
    int objectX;
    int objectY;
    const int targetX = 200; // 物体移动的目标 X 坐标
    const int targetY = 400; // 物体移动的目标 Y 坐标
    bool collisionDetected;
    bool ismoving;
    bool isPaused;
    bool isJumping=false;
    int jumpHeight=0; // 跳跃高度
    const int maxJumpHeight = 180; // 最大跳跃高度
    const int jumpStep = 25; // 每次跳跃的步长
signals:
};

#endif // GAMESCENE_H
